//
//  SXChannelLabel.m
//  NetEase-News
//
//  Created by 沈欣 on 2017/9/12.
//  Copyright © 2017年 沈欣. All rights reserved.
//

#define RGBColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]

#define RandomColor RGBColor(arc4random_uniform(255), arc4random_uniform(255), arc4random_uniform(255))

#import "SXChannelLabel.h"

@implementation SXChannelLabel

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.font = [UIFont systemFontOfSize:16.0];
        self.textAlignment = NSTextAlignmentCenter;
        
       // self.backgroundColor = RandomColor;
    }
    return self;
}

- (void)setScale:(CGFloat)scale {
    _scale = scale;
    
    // 颜色渐变 : 黑到红Red:0~1
    self.textColor = [UIColor colorWithRed:scale green:0 blue:0 alpha:1];
    
    CGFloat minScale = 1.0;
    CGFloat maxScale = 1.2;
    scale = minScale + (maxScale - minScale) * scale;
    
    // 缩放 : 参数如果是1.0,表示不会缩放;
    // 需求: 是在自己原本大小的基础之上进行0.2的缩放,缩小是回到原本大小
    self.transform = CGAffineTransformMakeScale(scale, scale);
}

@end
